package cn.cyber.wxfire.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author gjn
 * @since 2021/9/18 0:53
 */
public class JacksonUtil {
    private static final ObjectMapper MAPPER = new ObjectMapper();

    public static <T> T jsonToObj(String jsonStr, Class<T> objType) {
        T t = null;
        try {
            t = MAPPER.readValue(jsonStr, objType);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return t;
    }
}
